package com.ybq.library.service;

/**
 * @author : Ybq777
 * @version : 1.0.0
 * @description :
 * @createTime : 2024/12/2 16:58
 */

import com.ybq.library.dao.YbqUserMapper;
import com.ybq.library.entity.YbqUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YbqUserService {

    private final YbqUserMapper userMapper;
    @Autowired
    public YbqUserService(YbqUserMapper userMapper) {
        this.userMapper = userMapper;
    }
    // 新增用户信息业务逻辑
    public void addUser(YbqUser user) {
        userMapper.insertUser(user);
    }


    // 删除用户信息业务逻辑，需验证权限（这里假设在调用处已验证）
    public void deleteUserById(String userId) {
        userMapper.deleteUserById(userId);
    }

    // 修改用户信息业务逻辑，需验证权限（这里假设在调用处已验证）
    public void updateUser(YbqUser user) {
        userMapper.updateUser(user);
    }

    // 查询用户信息业务逻辑
    public List<YbqUser> getUserBySingleCondition(String condition, Object value) {
        return userMapper.selectUserBySingleCondition(condition, value);
    }

    // 查询所有用户信息业务逻辑
    public List<YbqUser> getAllUsers() {
        return userMapper.selectAllUsers();
    }

    public YbqUser getUserBySingleCondition1(String condition, Object value) {
        return userMapper.selectUserBySingleCondition1(condition, value);
    }
}